<template>
  <div id="app">
    <!-- <img alt="Vue logo" src="./assets/logo.png" /> -->
    <HelloWorld msg="Welcome to Your Vue.js App" />
    <div>
      <input type="text" v-model="info" />
      <button @click="handlerClick">添加</button>
    </div>
    <ul>
      <todo-item v-for="item in list" :key="item">
        <template v-slot:slot="itemProps">
          <span
            slot="slot"
            :style="{
              fontSize: '20px',
              color: itemProps.checked ? 'red' : 'blue',
            }"
            >{{ item }}</span
          >
        </template>
      </todo-item>
    </ul>
    <computed-com/>
    <function-button>
      click me
    </function-button>

    <life-cycle/>
    <datachange/>
    <use-directives/>
  </div>
</template>

<script>
import HelloWorld from "./components/HelloWorld.vue";
import TodoItem from "./components/TodoItem";
import ComputedCom from './components/ComputedCom.vue';
import FunctionButton from './components/TmpVar';
import LifeCycle from './components/LifeCycle.vue';
import Datachange from './components/Datachange.vue';
import UseDirectives from './components/UseDirectives.vue';

export default {
  name: "App",
  data() {
    return {
      msg: "hello vue",
      info: "",
      list: [],
    };
  },
  methods: {
    handlerClick() {
      console.log(this.info);
      this.list.push(this.info);
      this.info = "";
    },
  },
  components: {
    HelloWorld,
    TodoItem,
    ComputedCom,
    FunctionButton,
    LifeCycle,
    Datachange,
    UseDirectives,
  },
};
</script>

<style>
/* #app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
} */
</style>
